<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ page language="java" pageEncoding="utf-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<%@ include file="../../common/common.jsp" %>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>角色列表 - ${title }</title>
</head>
<link href="${ctx }/static/plugins/zTree_v3/css/zTreeStyle.css" rel="stylesheet"/>
<body
        <%@ include file="../../common/skin.jsp" %>
>
<%@ include file="../../common/head.jsp" %>
<%@ include file="../../common/menu.jsp" %>
<div class="J_content">
    <div class="mt20 plr20">
        <form action="${ctx }/information/recruitmentInformation" id="queryForm" method="POST">
            <div class="J_toolsBar clearfix">
                <select name="publishType" class="t_text ml10" style="border-radius: 6px">
                    <option value="-1" selected>-发布类型-</option>
                    <option value="全职" <c:if test="${jobQueryDTO.publishType == '全职'}">selected</c:if>>全职</option>
                    <option value="兼职" <c:if test="${jobQueryDTO.publishType == '兼职'}">selected</c:if>>兼职</option>
                </select>
                <select name="auditFlag" class="t_text ml10" style="border-radius: 6px">
                    <option value="-1" selected>-审核状态-</option>
                    <option value="0" <c:if test="${jobQueryDTO.auditFlag == 0}">selected</c:if>>待审核</option>
                    <option value="1" <c:if test="${jobQueryDTO.auditFlag == 1}">selected</c:if>>审核通过</option>
                    <option value="2" <c:if test="${jobQueryDTO.auditFlag == 2}">selected</c:if>>审核不通过</option>
                </select>
                <div class="t_text ml10">
                    <input placeholder="请输入职位名称" type="text" name="jobName"
                           value="${jobQueryDTO.jobName }" style="border-radius: 6px"/>
                </div>
                <select name="createDate" class="t_text ml10" style="border-radius: 6px">
                    <option value="-1" selected>-时间↑↓-</option>
                    <option value="desc" <c:if test="${jobQueryDTO.sortNum == 'desc'}">selected</c:if>>时间↑</option>
                    <option value="asc" <c:if test="${jobQueryDTO.sortNum == 'asc'}">selected</c:if>>时间↓</option>
                </select>
                <div class="t_button mgl30">
                    <a class="abtn red" href="javascript:myQuery();">
                        <i class="icon"></i>查询
                    </a>
                </div>
                <div class="t_label ml10">
                    记录数：<label style="color: red;" id="total">${page.totalCount }</label>
                </div>
            </div>
            <div class="J_table mt20">
                <div class="t_table">
                    <table>
                        <thead>
                        <tr>
                            <td>
                                <span>序号</span>
                            </td>
                            <td>
                                <span>发布类型</span>
                            </td>
                            <td>
                                <span>职位名称</span>
                            </td>
                            <td>
                                <span>职位类别</span>
                            </td>
                            <td>
                                <span>招聘人数</span>
                            </td>
                            <td>
                                <span>每月薪资</span>
                            </td>
                            <td>
                                <span>学历要求</span>
                            </td>
                            <td>
                                <span>工作经验</span>
                            </td>
                            <td>
                                <span>省市区</span>
                            </td>
                            <td>
                                <span>创建时间</span>
                            </td>
                            <td>
                                <span>审核</span>
                            </td>
                            <td>
                                <span>操作</span>
                            </td>
                        </tr>
                        </thead>
                        <tbody>
                        <c:choose>
                            <c:when test="${page.list != null && page.totalCount > 0 }">
                                <c:forEach items="${page.list }" var="r" varStatus="status">
                                    <tr>
                                        <td class="first">
                                            <div class="t_text tc">
                                                    ${status.index+1 }
                                            </div>
                                        </td>
                                        <td>
                                            <div class="t_text tc">
                                                    ${r.publishType}
                                            </div>
                                        </td>
                                        <td>
                                            <div class="t_text tc">
                                                    ${r.jobName }
                                            </div>
                                        </td>
                                        <td>
                                            <div class="t_text tc">
                                                    ${r.columnInfo.name}
                                            </div>
                                        </td>
                                        <td>
                                            <div class="t_text tc">
                                                    ${r.number }
                                            </div>
                                        </td>
                                        <td>
                                            <div class="t_text tc">
                                                <c:choose>
                                                    <c:when test="${r.state == 0}">
                                                        ${r.moneyMin}～${r.moneyMax}
                                                    </c:when>
                                                    <c:otherwise>
                                                        面议
                                                    </c:otherwise>
                                                </c:choose>
                                            </div>
                                        </td>
                                        <td>
                                            <div class="t_text tc">
                                                    ${r.educationalRequirements }
                                            </div>
                                        </td>
                                        <td>
                                            <div class="t_text tc">
                                                    ${r.workExperience }
                                            </div>
                                        </td>
                                        <td>
                                            <div class="t_text tc">
                                                    ${r.provinces }
                                            </div>
                                        </td>
                                        <td>
                                            <div class="t_text tc">
                                                <fmt:formatDate value="${r.createDate }" pattern="yyyy-MM-dd HH:mm"/>
                                            </div>
                                        </td>
                                        <td>
                                            <div class="t_text tc">
                                                    ${r.auditFlag == 0 ? "待审核" : r.auditFlag == 1 ? "审核不通过" : "审核通过"   }
                                            </div>
                                        </td>
                                        <td>
                                            <div class="t_link">
                                                <a href="javascript:myEdit('${r.id }');"><i class="icon"></i>查看</a>
                                                <c:choose>
                                                    <c:when test="${r.auditFlag eq '0' }">
                                                        <a href="javascript:upDauditFlag('${r.id }', '2');"><i
                                                                class="icon"></i>通过</a>
                                                        <a href="javascript:upDauditFlag('${r.id }', '1');"><i
                                                                class="icon"></i>不通过</a>
                                                    </c:when>
                                                    <c:when test="${r.auditFlag eq '2' }">
                                                        <a href="javascript:upDauditFlag('${r.id }', '1');"><i
                                                                class="icon"></i>不通过</a>
                                                    </c:when>
                                                    <c:otherwise>
                                                        <a href="javascript:upDauditFlag('${r.id }', '2');"><i
                                                                class="icon"></i>通过</a>
                                                    </c:otherwise>
                                                </c:choose>
                                            </div>
                                        </td>
                                    </tr>
                                </c:forEach>
                            </c:when>
                            <c:otherwise>
                                <tr>
                                    <td colspan="6">
                                        <div class="J_null mt40">
                                            <img src="${ctx }/static/images/null.png">
                                            <p>暂无相关数据</p>
                                        </div>
                                    </td>
                                </tr>
                            </c:otherwise>
                        </c:choose>
                        </tbody>
                    </table>
                </div>
                <%@ include file="../../common/pager.jsp" %>
            </div>
        </form>
    </div>
</div>
<script type="text/javascript" src="${ctx }/static/plugins/zTree_v3/js/jquery.ztree.all.min.js"></script>
<script type="text/javascript">
    <%--跳转页面到编辑页--%>

    function myEdit(id) {
        var loadIdx = layer.load();
        var title = '详情预览';
        $.post('${ctx}/information/recruitmentInformation/edit?id=' + id, {}, function (str) {
            layer.close(loadIdx);
            layer.open({
                title: title,
                type: 1,
                area: ['600px', '600px'],
                content: str,
                yes: function (index, layero) {
                    mySubmit();
                },
                btn2: function (index, layero) {
                    layer.close(index);
                }
            });
        });
    }


    function mySubmit() {
        $('#editForm').submit();
    }


    function myQuery() {
        $('#queryForm').submit();
    }

    function upDauditFlag(id, auditFlag) {
        var content = '确定要执行此操作吗？';
        layer.confirm(content, function (index) {
            layer.close(index);

            var loadIdx = layer.load();
            $.ajax({
                url: '${ctx}/information/recruitmentInformation/update',
                type: 'post',
                data: {
                    'id': id,
                    'auditFlag': auditFlag
                },
                traditional: true,
                success: function (result) {
                    layer.close(loadIdx);
                    if (result.success) {
                        layer.alert('操作成功', function () {
                            window.location.reload();
                        });
                    } else {
                        layer.alert(result.msg);

                    }
                }
            });
        });
    }
</script>
</body>
</html>